import pika
# 如果有用户名和密码就要加下面这行
# credentials = pika.PlainCredentials('root', '123')
connection = pika.BlockingConnection(pika.ConnectionParameters('81.71.137.167'))
channel = connection.channel()

channel.exchange_declare(exchange='m2', exchange_type='direct')

channel.basic_publish(exchange='m2',
                      routing_key='sbb',
                      body='msg6')

connection.close()